class BubbleSort():
    def __init__(self) -> None:
        self.count = 0
        pass

    # 进行排序
    def sort(self,ls):
        for i in range(len(ls)):
            for j in range(i):
                self.count+=1
                # i位置的数最大
                if ls[i]<ls[j]:
                    ls[i],ls[j] = ls[j],ls[i]
    # 判断是否有序
    def isSorted(self,ls):
        for i in range(1,len(ls)):
            if ls[i]<ls[i-1]:
                return False
        return True

